package com.example.receiver;

import android.annotation.SuppressLint;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class BroadreceiverReceiveData extends BroadcastReceiver {

	double emerlat;
	double emerlng;
	double getemerlat;
	double getemerlng;
	String emerlat1;
	String emerlng1;
	String getemerlat1;
	String getemerlng1;
	String voiceurl;


	@SuppressLint("InlinedApi")
	@Override
	public void onReceive(Context context, Intent intent) {
		// TODO Auto-generated method stub
		
		
		getemerlat1 = intent.getStringExtra("emerlat1");
		getemerlng1 = intent.getStringExtra("emerlng1");
		voiceurl = intent.getStringExtra("VoiceMsgURL");
		System.out.println("voiceurl : "+voiceurl);
		
		if(!(getemerlat1.equals("null")&&getemerlng1.equals("null"))&& voiceurl.equals("null")){
		
		
		Log.d("llat: ","" +getemerlat);
		Log.d("llat1: ","" +getemerlat1);
		
		Intent i = new Intent(context.getApplicationContext(), GetData.class);

		Log.d("test1", "1");

		i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK
				| Intent.FLAG_ACTIVITY_CLEAR_TOP
				| Intent.FLAG_ACTIVITY_NEW_TASK);
		i.putExtra("emerlat",  Double.parseDouble(getemerlat1));
		i.putExtra("emerlng",  Double.parseDouble(getemerlng1));
		context.startActivity(i);
		}
		
		else if(!(getemerlat1.equals("null")&&getemerlng1.equals("null"))&&!voiceurl.equals("null")){
			Intent i = new Intent(context.getApplicationContext(), VoiceShow.class);

			Log.d("testclass", "1");

			i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK
					| Intent.FLAG_ACTIVITY_CLEAR_TOP
					| Intent.FLAG_ACTIVITY_NEW_TASK);
			i.putExtra("voiceurl",voiceurl);
			i.putExtra("emerlat",  Double.parseDouble(getemerlat1));
			i.putExtra("emerlng",  Double.parseDouble(getemerlng1));
			context.startActivity(i);
		}

	}

}
